﻿<Application x:Class="DeSleeper.Client.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Properties="clr-namespace:DeSleeper.Client.Properties"
             xmlns:Framework="clr-namespace:DeSleeper.Client.Framework;assembly=DeSleeper.Client.Framework"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <Properties:Settings x:Key="Settings" />
        <DataTemplate DataType="{x:Type Framework:CommandMessage}">
            <Grid x:Name="Container">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock x:Name="Message"
                           Grid.Column="0"
                           Text="{Binding Message}"
                           Foreground="White"
                           TextWrapping="Wrap"
                           HorizontalAlignment="Stretch"
                           FontSize="14"
                           Padding="4"
                           FontWeight="Bold" />
                <Button x:Name="Acknowledge"
                        ToolTip="Acknowledge and Dimiss Message"
                        Grid.Column="1"
                        Command="{Binding ElementName=_this, Path=ViewModel.AcknowledgeMessageCommand}"
                        CommandParameter="{Binding}">
                    X
                </Button>
                <Grid.Triggers>
                    <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                        <BeginStoryboard>
                            <Storyboard BeginTime="0"
                                        Duration="0:0:5">
                                <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                                 To="{Binding Path=Opacity, ElementName=Container}"
                                                 From="0" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Grid.Triggers>
            </Grid>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding MessageType}"
                             Value="Error">
                    <Setter TargetName="Container"
                            Property="Background">
                        <Setter.Value>
                            <SolidColorBrush Opacity=".3"
                                             Color="Red" />
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
                <DataTrigger Binding="{Binding MessageType}"
                             Value="Warning">
                    <Setter TargetName="Container"
                            Property="Background">
                        <Setter.Value>
                            <SolidColorBrush Opacity=".3"
                                             Color="Yellow" />
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
                <DataTrigger Binding="{Binding MessageType}"
                             Value="Progress">
                    <Setter TargetName="Container"
                            Property="Background">
                        <Setter.Value>
                            <SolidColorBrush Opacity=".3"
                                             Color="Blue" />
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
                <DataTrigger Binding="{Binding MessageType}"
                             Value="Success">
                    <Setter TargetName="Container"
                            Property="Background">
                        <Setter.Value>
                            <SolidColorBrush Opacity=".3"
                                             Color="Green" />
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
        
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="MinHeight"
                    Value="10" />
            <Setter Property="MinWidth"
                    Value="120" />
            <Setter Property="Margin"
                    Value="4" />
            <Setter Property="VerticalAlignment"
                    Value="Center" />
        </Style>
        <Style TargetType="{x:Type ComboBox}">
            <Setter Property="MinHeight"
                    Value="10" />
            <Setter Property="MinWidth"
                    Value="120" />
            <Setter Property="Margin"
                    Value="4" />
            <Setter Property="VerticalAlignment"
                    Value="Center" />
        </Style>
        <Style TargetType="{x:Type CheckBox}">
            <Setter Property="Margin"
                    Value="4" />
            <Setter Property="VerticalAlignment"
                    Value="Center" />
        </Style>
        <Style TargetType="{x:Type Button}">
            <Setter Property="Margin"
                    Value="4" />
            <Setter Property="Padding"
                    Value="10,1" />
        </Style>
        <Style TargetType="{x:Type Label}">
            <Setter Property="Margin"
                    Value="4,2" />
            <Setter Property="VerticalAlignment"
                    Value="Center" />
            <Setter Property="HorizontalContentAlignment"
                    Value="Right" />
            <Setter Property="HorizontalAlignment"
                    Value="Right" />
        </Style>
    </Application.Resources>
</Application>
